package com.tanhua.dubbo.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.api.SoulOptionsApi;
import com.tanhua.dubbo.mapper.SoulOptionsMapper;
import com.tanhua.dubbo.pojo.SoulOptions;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService(version = "1.0.0")
public class SoulOptionsApiImpl implements SoulOptionsApi {

    @Autowired
    private SoulOptionsMapper soulOptionsMapper;

    @Override
    public SoulOptions selectOne(String option) {

        QueryWrapper<SoulOptions> queryWrapper = new QueryWrapper<>();
        // queryWrapper.eq("questionid", questionid);
        queryWrapper.eq("id", option);

        return soulOptionsMapper.selectOne(queryWrapper);
    }

    @Override
    public List<SoulOptions> selectList(Long id) {
        QueryWrapper<SoulOptions> soulOptionsQueryWrapper = new QueryWrapper<>();
        soulOptionsQueryWrapper.eq("questionid", id);
        return soulOptionsMapper.selectList(soulOptionsQueryWrapper);
    }
}
